package com.circle.util;

import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;

public class CheckUtils {

    public static boolean checkIsNull(Object obj) {

        if (null == obj) {
            return true;
        } else if (obj instanceof CharSequence) {
            if (((CharSequence) obj).length() == 0) {
                return true;
            }
            String paramString = obj.toString().toLowerCase();
            if ("null".equals(paramString)) {
                return true;
            }
        } else if (obj instanceof Collection) {
            return ((Collection) obj).isEmpty();
        } else if (obj instanceof Map) {
            return ((Map) obj).isEmpty();
        } else if (obj.getClass().isArray()) {
            return Array.getLength(obj) == 0;
        }

        return false;
    }


}
